<template>
    <view>
        <public-module></public-module>
        <wlk-navbar title="提现记录" navbarType='3'></wlk-navbar>

        <block v-if="loadStatus=='nomore' && list.length==0">
            <view class="not-data">
                <u-empty
                        :icon="uEmpty.search"
                        text="没有搜索结果"
                >
                </u-empty>
            </view>
        </block>
        <block v-else>
            <view class="list pd30">
                <view class="item wd100 bgw pd30 mb20 br04" v-for="(item,index) in list" :key="item.id">
                    <view class="head wlkflex justify-between wd100">
                        <view class="head-sn">
                            单号：{{item.apply_sn}}
                        </view>
                        <view class="head-money">
                            ￥{{item.money}}
                        </view>
                    </view>

                    <u-divider></u-divider>
                    <view>
                        <view class="wlkflex justify-between mb10">
                            <view>提现方式</view>
                            <view>{{item.apply_type_text }}</view>
                        </view>
                        <view class="wlkflex justify-between mb10">
                            <view>手续费</view>
                            <view>￥{{item.charge_money }}</view>
                        </view>
                        <view class="wlkflex justify-between mb10">
                            <view>申请时间</view>
                            <view>{{$u.timeFormat(item.createtime,'yyyy-mm-dd hh:MM:ss')}}</view>
                        </view>
                        <view class="wlkflex justify-between mb10">
                            <view>申请状态</view>
                            <view>
                                <u--text type="warning" v-if="item.status=='0'" align="right" size="14"
                                         :text="item.status_text"></u--text>
                                <u--text type="info" v-if="item.status<'0'" align="right" size="14"
                                         :text="item.status_text"></u--text>
                                <u--text type="error" v-if="item.status>'0'" align="right" size="14"
                                         :text="item.status_text"></u--text>
                            </view>
                        </view>
                        <view class="wlkflex justify-between align-start mb10" v-if="item.status=='-1'">
                            <view>拒绝原因</view>
                            <view class="col9 wd50">{{item.sys_msg }}</view>
                        </view>
                    </view>
                </view>
                <view class="load-more">
                    <u-loadmore :status="loadStatus" :loading-text="loadingText" :loadmore-text="loadmoreText"
                                :nomore-text="nomoreText" dashed line/>
                </view>
            </view>
        </block>
    </view>


</template>

<script>
    var _self;
    import {mapGetters} from 'vuex';

    export default {
        computed: {
            ...mapGetters(['themeColor', 'uEmpty'])
        },
        data() {
            return {
                list: [],
                current: 0,
                page: 1,
                loadStatus: 'loading',
                loadingText: '努力加载中',
                loadmoreText: '轻轻上拉',
                nomoreText: '实在没有了',

            };
        },
        onLoad(options) {
            _self = this;
        },
        onShow() {
            _self.loadStatus = 'loading';
            _self.page = 1;
            _self.list = [];
            _self.getData();
        },
        onReachBottom() {
            if (this.loadStatus == "nomore") {
                return;
            }
            this.page++;
            this.getData();
        },
        methods: {

            async getData() {
                const res = await uni.$u.http.post("wallet/getWithdrawList", {
                    page: this.page,
                });
                if (res && res.data && res.data.rows) {
                    this.list = this.list.concat(res.data.rows);
                }

                console.log(this.list)

                this.loadStatus = res.data.rows.length < res.data.limit ? 'nomore' : 'loadmore';
            }
        }
    };
</script>

<style lang="scss">
    .list {
        .item {
            font-size: $font-base;
            .head {
                font-size: $font-base;
                .head-sn {
                    width: 80%;
                    color: $uni-text-color-grey;
                    font-size: $font-base;
                }

                .head-money {
                    width: 20%;
                    text-align: right;
                    color: $-tour-price-color;
                    font-size: $font-base;
                }
            }
        }
    }

</style>
